package com.codeforces.contest.c302;


import java.util.Arrays;
import java.util.Scanner;

public class _302B {

	static Scanner scanner = new Scanner(System.in);
	static int n, m, c, d, v;
	static int[] mark;
	
	public static void main(String[] args) {
		n = scanner.nextInt();
		m = scanner.nextInt();
		mark = new int[n+1];
		mark[0] = 0;
		for (int i=1;i<=n;++i) {
			c = scanner.nextInt();
			d = scanner.nextInt();
			mark[i] = mark[i-1] + c*d;
		}
		for (int i=1;i<=m;++i) {
			v = scanner.nextInt();
			int idx= Arrays.binarySearch(mark, v);
			if (idx < 0) {
				idx = -1 - idx;
			}
			System.out.println(idx);
		}

	}

}
